<%-- 
    Document   : newslist
    Created on : Apr 13, 2012, 11:45:59 AM
    Author     : dhananjay
--%>

<%@page import="jobportal.Dbconn"%>
<%@page import="java.sql.ResultSet"%>
<%@page import="java.sql.Statement"%>
<%@page import="java.sql.Connection"%>
<%@include file="header.jsp" %>

<form name="form1" action="newslist.jsp" method="post">
    <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
            <td colspan="4">&nbsp;</td>
        </tr>
        <tr>
            <td height="24" colspan="2" align="left" ><strong>NEWS MANAGER  - News List</strong>                              </td>
            <td height="24" colspan="2" align="right" ><a href="addnews.jsp"><img src="../images/news_add.png"/><br/>Add News </a></td>
        </tr>
        <tr>
            <td colspan="4" align="center" valign="top" ><table width="100%" style="border: 1px solid rgb(169, 211, 225);" align="center" cellpadding="0" cellspacing="1">
                    <tr align="center" valign="middle" class="bluebg">
                        <td class="greyheadertext" valign="middle" width="12%"><strong>Date</strong></td>
                        <td class="greyheadertext" height="25" align="left" valign="middle" width="20%"><strong>News Heading</strong></td>
                      <td class="greyheadertext" align="center" valign="middle" width="61%"><strong>News Details</strong></td>
                      <td colspan="3" align="center" valign="middle" class="greyheadertext"><strong>Action</strong></td>
                    </tr>
                    <%
                                Connection con = null;
                                Statement st = null, st1 = null;
                                ResultSet rs = null, rs1 = null;
                                try {
                                    con = Dbconn.getConn();
                                    st = con.createStatement();
                                    st1 = con.createStatement();
                                    //int nojobs,activejobs;
                                    // rs=select count(*) as cnt from jobs
                                    rs = st.executeQuery("select * from news");

                                    while (rs.next()) {

                    %>
                    <tr>
                        <td height="27" align="left" valign="middle" bgcolor="#EDEDDE" class="deepbluetext"><%=rs.getDate("date")%></td>
                        <td align="left" valign="middle" bgcolor="#EDEDDE" class="deepbluetext"><%=rs.getString("heading")%></td>
                        <td align="center" valign="middle" bgcolor="#EDEDDE" class="deepbluetext"><div align="center"><%=rs.getString("details")%></div>
                            <div align="justify"></div></td>
                        <td class="deepbluetext" align="center" valign="middle" bgcolor="#EDEDDE" width="2%"><a href="editnews.jsp?newsid=<%=rs.getInt("id")%>"><img src="../images/news_edit.png"  border="0"></a></td>
                        <td class="deepbluetext" align="center" valign="middle" bgcolor="#EDEDDE" width="5%"><a href="DeleteNews?newsid=<%=rs.getInt("id")%>" onClick="javascript: return confirm('All the  information related to this News will be deleted.\n\nDo you really want to delete the News ?');"><img src="../images/news_remove.png"  border="0"></a></td>
                    </tr>
                    <%}
                                } catch (Exception e) {
                                    out.println(e);

                                }%>
                </table></td>
        </tr>
    </table>
</form>

<%@include file="footer.jsp" %>